const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin');

/**
 * @type { import('webpack').Configuration }
 */
const config = {
    mode: "none",
    devtool: 'eval',
    devServer: {

    },
    entry: {
        index: './src/index.js',
        // test: './src/test.js'
    },
    output: {
        filename: "[name].[chunkhash].js",
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: ['style-loader', 'css-loader']
            },
            {
                test: /\.js$/,
                use: [
                    {
                        loader: path.resolve('./loaders/compile.js'),
                        options: {
                            name: 'compile'
                        }
                    }
                ]
            }
        ]
    },
    plugins: [
        new CleanWebpackPlugin(),
        new HtmlWebpackPlugin({
            title: 'output management'
        }),
    ]
}

module.exports = config;